var my_vue;
$(function(){
	var code = parseQueryString().code;
	var userId = sessionStorage.getItem("userId");
	var index = isEmpty(parseQueryString().index)?'input':parseQueryString().index;
	 my_vue = new Vue({
		el: '#vue_info',
		data: {
			workName:'',
			workNum:''
		},
		methods: {
			//获取面对面连接状态
			setFaceService: function() {
				if(index=='consult'){
					userId = "10000";
					code = "10000";
				}
				$.ajax({
					url: 'http://192.168.10.45:8888/oc_tengzhou/face/setFaceService.do?t='+new Date().getTime(),
					data: {
						userId: userId,
						code:code
					},
					async: true,
					type: 'post',
					success: function(result) {
						var obj = toObj(result);
						if(obj.success) {
							serverVoipName = obj.data.voipNum;
							this.workName = obj.data.workName;
							this.workNum = obj.data.workNum;
							ronglianyunInit();
						} else {
							showRedMsg("","连接失败!");
						}
					},
					error: function() {
						showRedMsg("","连接失败!");
					}
				});
			},
			//自助端退出排队type = 取消 3  完成 2 等待0 行进中1
			setFaceState: function(type) {
				if(index=='consult'){
					userId = "10000";
					code = "10000";
				}
				$.ajax({
					url: 'http://192.168.10.45:8888/oc_tengzhou/face/setFaceState.do?t='+new Date().getTime(),
					data: {
						userId: userId,
						type:type
					},
					async: true,
					type: 'post',
					success: function(result) {
						var obj = toObj(result);
						if(obj.success) {
							if(type==1){
								my_vue.changeTop();
							}
						} else {
							showRedMsg("","连接失败!");
						}
					},
					error: function() {
						showRedMsg("","连接失败!");
					}
				});
			},
			//挂断后回调
			exitCallBack:function(){
				window.opener.location.href="../gover/index.html"; 
			},
			changeTop:function(){
				$("#videoObject").animate({top:"162px"},1000);
			}
		},
		ready: function() {
			//初始化获得总页面数和列表数据
			this.setFaceService();
		}
	});
	
});